/*
 * simple FIFO handling
 *
 * Copyright (C) 2008  Bartlomiej Zolnierkiewicz
 */

#ifndef __FIFO_H
#define __FIFO_H

typedef struct fifo {
	void **q;	/* points to FIFO queue */
	int size;	/* total queue size */
	int first;	/* first element index */
	int last;	/* last element index */
	int count;	/* current element count */
} fifo_t;

fifo_t *fifo_alloc(int);
void fifo_free(fifo_t *);

void fifo_enqueue(fifo_t *, void *);
void *fifo_dequeue(fifo_t *);

int fifo_empty(fifo_t *);
int fifo_full(fifo_t *);

void fifo_dump(fifo_t *);

#endif /* __FIFO_H */
